how to close text file in python